<?php
namespace aa;
include 'helpers.php';

use Closure;
class Person extends Base{
    public $name;
    public $age;

     public function say(){
        return 'name:'.$this->name;
    }
    public function say1(){
        return 'age:'.$this->age;
    }

    public function  test(){
         $a=$this->getClosure();
        p($a);
    }
}


class Base{
    static public function name(){
        return '1123';
    }
    public static function age(){
        return 20;
    }

    public static function load(Person $person){
        return  Closure::bind(function ()use($person){
            $person->name=Base::name();
        },null,Person::class);
    }

    public  function getClosure(){
        return function ($person){
          // return $person->say();
        } ;
    }

}

$person=new Person();

$b=Base::load($person);
call_user_func($b);


p($person);

$person->test();




